<include file="public@storage"/>
<style>
    form {
        margin-top: 100px;
        padding-left: 50px;
        padding-right: 50px;
    }

</style>
</head>
<body>
<form class="form-horizontal table" id="form" onsubmit = "return checkUser()" action="{:url('storage/User/editUser')}"  method="post"  >
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">编辑用户</h3>
        </div>
        <div class="panel-body">
            <div class="form-group">
                <div class="col-md-2 control-label">
                    <label for="user_login">用户名：</label>
                </div>
                <div class="col-md-2">
                    <input type="text" name="user_login" id="user_login" value="{$user.user_login}" class="form-control" placeholder="必须填"
                           required="required" autocomplete="off" >
                    <input type="hidden" name="userId"  id="userId" value="{$user.id}">
                    <span id="user_login_error" style="color: red"></span>
                </div>

                <div class="col-md-2 control-label">
                    <label for="user_login">姓名：</label>
                </div>
                <div class="col-md-2">
                    <input type="text" name="user_nickname" id="user_nickname" value="{$user.user_nickname}" class="form-control" placeholder="必须填"
                           required="required" autocomplete="off">
                    <span id="user_nickname_error" style="color: red"></span>
                </div>

                <div class="col-md-2 control-label">
                    <label for="user_pass">密码：</label>
                </div>
                <div class="col-md-2">
                    <input type="password" name="user_pass" id="user_pass" value="{$user.user_pass}" class="form-control" placeholder="必须填"
                           autocomplete="off" required="required">
                    <span id="password_error" style="color: red"></span>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-2 control-label">
                    <label for="role_id">角色：</label>
                </div>
                <div class="col-md-2">
                    <input type="hidden" id="roleId" value="{$user.role_id}">
                    <select id="role_id" name="role_id" class="selectpicker  form-control"  title="请选择角色" data-live-search="true">
                        <volist name="role" id="vo">
                            <option value="{$vo.id}">{$vo.name}</option>
                        </volist>
                    </select>
                    <span id="role_id_error" style="color: red"></span>
                </div>

                <div class="col-md-2 control-label">
                    <label for="storage">负责仓库：</label>
                </div>
                <div class="col-md-2">
                    <input type="hidden" id="storageList" value="{$storageUuid}">
                    <select id="storage" name="storage[]" class="selectpicker  form-control" title="所属仓库" data-live-search="true"
                            multiple data-selected-text-format="count > 3" data-actions-box="true">
                        <volist name="storage" id="vo">
                            <option value="{$vo.uuid}">{$vo.name}</option>
                        </volist>
                    </select>
                    <span id="storage_error" style="color: red"></span>
                </div>
            </div>
        </div>
        <div class="form-group text-center">
            <button type="submit" class="mui-btn mui-btn--raised mui-btn--primary" id="submit">保存</button>
            &nbsp; &nbsp;
            <button type="button" class="mui-btn mui-btn--raised mui-btn--primary" onclick="history.go(-1)">取消</button>
        </div>
    </div>
</form>
</body>
<script src="__STATIC__/storage/js/staff/add.js"></script>
<script>
    window.onload = function () {
        $("#role_id").selectpicker('val', $('#roleId').val());
        var storageList = $('#storageList').val();
        storageList = storageList.split(',');
        $("#storage").selectpicker('val', storageList);
    };


</script>
</html>